'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;

  //前台
  // router.get('/', controller.web.home.index);
  // router.get('/home/:id',controller.web.home.home);
  // router.get('/mood/index',controller.web.home.mood);
  // router.get('/memory/index',controller.web.home.memory)
  // router.get('/archives/index',controller.web.home.archives)
  // router.get('/message/index',controller.web.home.message)
  // router.get('/github/login',controller.web.home.loginGitHub)
  // router.get('/oauth/github/callback',controller.web.home.loginCallback)
  // router.get('/github/islogin',controller.web.home.isLogin)
  // router.get('/github/isloginforssh',controller.web.home.isLoginForSsh)
  // router.get('/github/destory',controller.web.home.destory)
  // router.get('/detail/:item',controller.web.home.detail)

  //后台
  router.get('/api/index',controller.admin.admin.index)
  router.post('/api/user/login',controller.admin.admin.login)
  router.get('/api/mp/login',controller.admin.admin.mpLogin)

  //socket.io
  io.of('/').route('server',io.controller.home.server)
  io.of('/').route('islogin',io.controller.home.isLogin)
  io.of('/').route('loginGithub',io.controller.home.loginGithub)

  //duuchin user
  router.resources("duuchin","/api/duuchin",controller.duuchin.duuchin)// 只使用与crud
  router.post('/api/user/list',controller.user.getList)
  router.get('/api/user/info/:id',controller.user.getInfo)

  // song
  router.post('/api/song/list',controller.song.getList)
  router.get('/api/song/info/:id',controller.song.getInfo)

  // video
  router.post('/api/video/list',controller.video.getList)
  router.get('/api/video/info/:id',controller.video.getInfo)

  // article
  router.post('/api/article/list',controller.article.getList)
  router.get('/api/article/info/:id',controller.article.getInfo)

  // recommend
  router.post('/api/recommend/list',controller.recommend.getList)
}

